﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="account.aspx.cs" Inherits="WebSite.cn.account" %>
<%@ Register Src="head.ascx" TagName="head" TagPrefix="uc1" %>
<%@ Register Src="bottom.ascx" TagName="bottom" TagPrefix="uc3" %>
<%@ Register src="../Controls/AddressArea.ascx" tagname="AddressArea" tagprefix="uc6" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title><%=WebSite.info.info1("", "shoptitle")%></title>
    <meta name="Description" content="<%=WebSite.info.info1("","shopcontent")%>" /> 
    <meta name="Keywords" content="<%=WebSite.info.info1("","shopkey")%>" />
    <link href="style.css" rel="stylesheet" type="text/css" />
    <script language="JavaScript" src="../../js/function.js"></script>
     <script language="JavaScript" src="../popcalendar.js"></script>
    <script language="javascript" type="text/javascript">


     function checkDateTime(from ,to) { 
if(from==""||to=="")return 2; 
var rValue = 0 ; 
for(var i=0 ;i<16 ;i++) { 
   if(from.charAt(i) < to.charAt(i)) { 
    rValue = 1 ; break ; } 
   else if(from.charAt(i) > to.charAt(i)) { rValue = -1 ; break ; } } return rValue ; 
} 

    function CheckFrm(){

        var div=document.getElementById("shipid");
        var tCname = document.getElementById("cname");
        var tAddress = document.getElementById("address");
          var tCname1 = document.getElementById("cname1");
        var tPost1 = document.getElementById("post1");
           var tPost = document.getElementById("post");
        var tAddress1 = document.getElementById("address1");
         var tTel = document.getElementById("tel");
         var tTel1 = document.getElementById("tel1");
        var tPhone = document.getElementById("phone");
        var tPhone1 = document.getElementById("phone1");
         var tEmail = document.getElementById("email");
        var tEmail1 = document.getElementById("email1");

          var tremark = document.getElementById("remark");
        var tremark1 = document.getElementById("remark1");


           var obj = document.getElementById('senddate');

        if(obj.value == "")
        {
           alert("送货日期不能为空");
            obj.focus();
            return false;
        }

           if(tCname.value == "")
        {
        alert("姓名不能为空");
        tCname.focus();
        return false;
        }else  if ((tTel.value=="")&&(tPhone.value=="")){
	        alert("电话和手机致少填一项!");
	        return false;
	       }
           else if(tAddress.value == "")
        {
        alert("地址不能为空");
        tAddress.focus();
        return false;
        }
	  
	    if(div.style.display=="")
	    {
	      if(tCname1.value == "")
            {
            alert("姓名不能为空");
            tCname1.focus();
            return false;
            }else   if ((tTel1.vl="")&&(tpPhone1.value=="")){
	         alert("电话和手机致少填一项!");
	         return false;
	         }
             else if(tAddress1.value == "")
            {
            alert("地址不能为空");
            tAddress1.focus();
            return false;
            }
	    }

        var dtArr = obj.value.split("-");
           var toDay = new Date();

        var dt1 = dtArr[0] + "-" + dtArr[1] + "-" + dtArr[2];
        var dt2 = toDay.getUTCFullYear()+ "-" + (parseInt(toDay.getMonth()) + 1) + "-" +  (parseInt(toDay.getDate()) + 2);


         var dtTmp1 = new Date(dt1.replace(/-/g,"/"));
        var dtTmp2 = new Date(dt2.replace(/-/g,"/"));
        if(dtTmp1 < dtTmp2)
       {
             alert('送货日期必须在两天之后（包括两天）！');    
             obj.value="";
             obj.focus();
             return false;
       }

  
          <% if (LoginMember != null ){ %>
	      if( parseFloat('<%=professionTotalPrice %>') > parseFloat('<%=UserCardTotalPrice %>'))
        {
           alert("专区金额不足!");
           return false;
        }
        else  if( parseFloat('<%=shoppingTotalPrice %>') > parseFloat('<%=accountmoney %>'))
        {
          alert("礼品商城账户余额不足!");
           return false;
        }
        else if(parseInt('<%=UserCardTotalPrice %>') != parseInt('<%=professionTotalPrice %>'))
        {
          alert("专区金额与兑换商品价格不符！请重新选择商品！");
          return false;
        }else
        {

      if( parseInt('<%=professionTotalPrice %>' + parseInt('<%=shoppingTotalPrice %>')) < 100)
        {
          if( confirm("您需多付10元送货费，确认要购买吗？"))
          {
          return true;
          }else
          {
          return false;
          }
        }
    
          return confirm("您确认要购买吗？");
        }
	     <%} %>
    

    if( parseInt('<%=professionTotalPrice %>' + parseInt('<%=shoppingTotalPrice %>')) < 100)
        {
          if( confirm("您需多付10元送货费，确认要购买吗？"))
          {
          return true;
          }else
          {
          return false;
          }
        } 
   
    }
    function checkcopy()
    {
        var div=document.getElementById("shipid");
        var tCname = document.getElementById("cname");
        var tAddress = document.getElementById("address");
          var tCname1 = document.getElementById("cname1");
        var tPost1 = document.getElementById("post1");
         var tPost = document.getElementById("post");
        var tAddress1 = document.getElementById("address1");
         var tTel = document.getElementById("tel");
         var tTel1 = document.getElementById("tel1");
        var tPhone = document.getElementById("phone");
        var tPhone1 = document.getElementById("phone1");
         var tEmail = document.getElementById("email");
        var tEmail1 = document.getElementById("email1");

          var tremark = document.getElementById("remark");
        var tremark1 = document.getElementById("remark1");
      tCname1.value=tCname.value;
      tTel1.value=tTel.value;
      tPhone1.value=tPhone.value;
      tPost1.value=tPost.value;
      tAddress1.value= document.getElementById("ddlProvence").value + document.getElementById("ddlArea").value + tAddress.value;
      tEmail1.value=tEmail.value;
      tremark1.value = tremark.value;
      //frm.remark1.value=frm.remark.value;
    }
    function chk1Clicked()
    {
    var chk=document.getElementById("chk1");
    var div=document.getElementById("shipid");
    if(chk.checked){div.style.display="none";}
    else div.style.display="";
    }


    function setPayMoney()
    {
     document.getElementById("spanmoney").innerHTML = "0";
       

         if(isNaN( document.getElementById("amountmoney").value))
         {
            alert("输入账户金额格式不正确，只能为数字！请重新输入");
            document.getElementById("amountmoney").value = "0";
            document.getElementById("amountmoney").focus();
            return;
         }
          var accountmoney = parseInt('<%=accountmoney %>') -  document.getElementById("amountmoney").value;
          var paymoney = parseInt('<%=shoppingTotalPrice %>') + 10 - document.getElementById("amountmoney").value;

          if(accountmoney < 0)
          {
              alert("输入账户金额大于您的账户余额！请重新输入");
            document.getElementById("amountmoney").value = "0";
            document.getElementById("amountmoney").focus();
            return;
          }

          if(paymoney<0)
          {
            alert("输入账户金额大于您实际商品总价！请重新输入");
            document.getElementById("amountmoney").value = "0";
            document.getElementById("amountmoney").focus();
            return;
          }else if(paymoney == 0)
          {
            document.getElementById("payway").style.display = "none";
             document.getElementById("cardpaymoney").value = document.getElementById("amountmoney").value;
          }
          else if(paymoney >0)
          {
           document.getElementById("payway").style.display = "inline";
           
            document.getElementById("cardpaymoney").value = document.getElementById("amountmoney").value;
           }

            document.getElementById("paymoney").value=paymoney.toString();
           document.getElementById("spanmoney").innerHTML= paymoney.toString();
    }
    
    </script>
</head>
<body>
   
     <center>
	<uc1:head ID="head_1" runat="server"  />


<div id="container">
   

      <div id="divTopMessage"  runat="server" align="left" style="line-height:40px; float:left; margin-top:20px;">
     <form id="form1" runat="server">
        <asp:Label ID="lblMoneyMessage"  ForeColor="Red" runat="server"></asp:Label> 
        <asp:LinkButton ID="lbtnExit" runat="server"  Text="退出" onclick="lbtnExit_Click"></asp:LinkButton>
       </form> 
      </div>
    

       
	  <div  style="margin-top:20px; float:left; width:100%;">

        <div id="divTitle" runat="server"  class="CarTitle"> </div>
	     <table width="100%" border="0" cellspacing="0"  class="article_content" style="border-top:2px solid #ff980d; ">
	      <tr bgcolor="#fff5e8">
	        <td width="90" height="28" align="center"><strong>商品图</strong></td>
	        <td align="left"><strong>商品名称</strong></td>
              <td width="90"><strong>商品类型</strong></td>
	        <td width="90" align="center"><strong>单价</strong></td>
	        <td width="90" align="center"><strong>数量</strong></td>
	        <td width="90" align="center"><strong>共计</strong></td>
            
	        <td width="90" align="center"><strong>操作</strong></td>
	        </tr>
	        <%=carinfo %>
	      </table>

           
          <%= CarInfo2Html %>

           
	     <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-bottom:2px solid #ff980d;">
          <tr style="background-color:#fff5e8;">
            <td>&nbsp;<a href="<%=BackHref %>" ><img src="images/az-addressbook-continue-shopping.gif" alt="继续购物" width="135" height="22" border="0" /></a></td>
            <td height="30" >专区商品总计：<span class="text_red"><%=professionTotalPrice%></span><span class="a_title_green"> 元 </span>
            &nbsp;&nbsp;礼品商品总计：<span class="text_red"><%=shoppingTotalPrice%></span><span class="a_title_green"> 元 </span>
            </td>
          </tr>

        </table>

		<br />
		<%if(LoginMember ==null && LoginMember.UserCardCodeList == null){ %>
		  <form name="lofrms" action="userinfo.aspx?action=login" method="post">
		  <div  align="left" style="padding-left:20px"> 
		     <ul>
             <li>
              <font size="3" color="red"> 【购买提示】</font>
             </li>
   
               <li>
                &nbsp; 1. 如您要用礼品卡购买<strong>（礼品商城）</strong>商品，请您先<a href="login.aspx" target="_self" style="color:Red;" >登录</a>或者（<a href="register.aspx" target="_self"  style="color:Red;" >注册新用户 </a>）后充值 
              </li>
                 <li>
                  &nbsp; 2. 如您要用礼品卡购买<strong>（专区类）</strong>商品，请通过<a href="ProfessionArea.aspx" target="_self"  style="color:Red;" >礼品卡登录</a> ，选取要购买的商品
               </li>
               <li>
                 &nbsp; 3. 如您不使用礼品卡，请通过我们提供的其它支付方式
               </li>
         </ul>
		  <br />
		</div>
		</form>
		 <%} %> 


		  <form id="frm" action="PayMoney.aspx" method="post">
		<input name="professionTotalPrice" type="hidden" value="<%=professionTotalPrice %>" />
        <input name="shoppingTotalPrice" type="hidden" value="<%=shoppingTotalPrice %>" />
		<div>
	       <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CECECE">
		     <tr>
		       <td height="25" bgcolor="#EEEEEE" class="white_bold">　<strong>下单人信息</strong></td>
		       <td align="left" bgcolor="#EEEEEE" class="white_bold"><input type="checkbox" name="chk1" id="chk1" onclick="chk1Clicked()" value="1" checked="checked" />
	             <label for="chk1"><strong>收件人信息与下单人信息相同</strong></label></td>
	        </tr>
		     <tr>
		       <td width="130" height="25" align="right" bgcolor="#FFFBF4">姓 名：</td>
		       <td align="left" bgcolor="#FFFFFF">　
	           <input name="cname" id="cname" value="<%=cname %>" class="box" size="20" maxlength="100" type="text" />*<input name="carid" type="hidden" value="<%=carid %>" /></td>
	        </tr>
		     <tr>
		       <td height="25" align="right" bgcolor="#FFFBF4">联系电话：</td>
		       <td align="left" bgcolor="#FFFFFF">　
	           <input name="tel" id="tel" value="<%=tel %>" class="box" size="20" maxlength="20" type="text" />
                   电话和手机致少填一项</td>
	        </tr>
		     <tr>
		       <td height="25" align="right" bgcolor="#FFFBF4">手 机：</td>
		       <td align="left" bgcolor="#FFFFFF">　
	           <input name="phone" id="phone" value="<%=phone %>" class="box" size="20" maxlength="20" type="text" /></td>
	        </tr>
		     <tr style="display:none">
		       <td height="25" align="right" bgcolor="#FFFBF4">邮 编：</td>
		       <td align="left" bgcolor="#FFFFFF">　
	           <input name="post" id="post" value="<%=post %>" class="box" size="20" maxlength="20" type="text" />*</td>
	        </tr>
		     <tr>
		       <td height="25" align="right" bgcolor="#FFFBF4">地 址：</td>
		       <td align="left" bgcolor="#FFFFFF">　
               

	           <uc6:AddressArea ID="AddressArea1" runat="server" />


	           <input name="address" id="address" value="<%=address %>" class="box" size="50" maxlength="255" type="text" />*</td>
	        </tr>
		     <tr  style="display:none">
		       <td height="25" align="right" bgcolor="#FFFBF4">E-MAIL：</td>
		       <td align="left" bgcolor="#FFFFFF">　
	           <input name="email" id="email" value="<%=email %>" class="box" size="50" maxlength="255" type="text" /></td>
	        </tr>
		     <tr>
		       <td height="25" align="right" bgcolor="#FFFBF4">送货日期：</td>
		        <td align="left" bgcolor="#FFFFFF">　
                <input name="senddate" id="senddate" class="box"  value="<%=sendDate %>" readonly  style="width: 80px;"  onclick='popUpCalendar(this, this, "yyyy-mm-dd");' type="text" />

                

	           </td>
	        </tr>
		     <tr>
		       <td height="25" align="right" bgcolor="#FFFBF4">备 注：</td>
		       <td align="left" bgcolor="#FFFFFF">　
	             <input id="remark" name="remark" class="box" type="text" style="width:560px" maxlength="300"/>
               </td>
	        </tr>
	      </table>
		<br />
	      <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CECECE" id="shipid" style="display:none;">
		     <tr>
		       <td height="25" bgcolor="#EEEEEE" class="white_bold">　<strong>收件人信息</strong></td>
		       <td align="left" bgcolor="#EEEEEE" class="white_bold"> <a href="javascript:checkcopy();">[复制下单人信息]</a></td>
	        </tr>
		     <tr>
		       <td width="130" height="25" align="right" bgcolor="#FFFBF4">姓 名：</td>
		       <td align="left" bgcolor="#FFFFFF">　
	           <input name="cname1" id="cname1"  class="box" size="20" maxlength="100" type="text" />*</td>
	        </tr>
		     <tr>
		       <td height="25" align="right" bgcolor="#FFFBF4">联系电话：</td>
		       <td align="left" bgcolor="#FFFFFF">　
	           <input name="tel1" id="tel1" class="box" size="20" maxlength="20" type="text" />
                   电话和手机致少填一项</td>
	        </tr>
		     <tr>
		       <td height="25" align="right" bgcolor="#FFFBF4">手 机：</td>
		       <td align="left" bgcolor="#FFFFFF">　
	           <input name="phone1" id="phone1" class="box" size="20" maxlength="20" type="text" /></td>
	        </tr>
		     <tr style="display:none">
		       <td height="25" align="right" bgcolor="#FFFBF4">邮 编：</td>
		       <td align="left" bgcolor="#FFFFFF">　
	           <input name="post1" id="post1" class="box" size="20" maxlength="20" type="text" />*</td>
	        </tr>
		     <tr>
		       <td height="25" align="right" bgcolor="#FFFBF4">地 址：</td>
		       <td align="left" bgcolor="#FFFFFF">　
	           <input name="address1" id="address1" class="box" size="50" maxlength="255" type="text" />*</td>
	        </tr>
		     <tr  style="display:none">
		       <td height="25" align="right" bgcolor="#FFFBF4">E-MAIL：</td>
		       <td align="left" bgcolor="#FFFFFF">　
	           <input name="email1" id="email1" class="box" size="50" maxlength="255" type="text" /></td>
	        </tr>
            <tr>
		       <td height="25" align="right" bgcolor="#FFFBF4">备 注：</td>
		       <td align="left" bgcolor="#FFFFFF">　
	          
              	             <input id="remark1" name="remark1"  class="box" type="text" style=" width:560px" maxlength="300"/>
              </td>
	        </tr>
	      </table>
		<br />
		</div>
		<div>
        <%if (LoginMember == null && LoginMember.UserCardCodeList == null)
          { %>  <%if (true)
                  {
                      this.divCardMessage.Visible = false;
                             %>
	      <table cellpadding="5" cellspacing="0"  width="95%">
            <tr>
		       <td height="25" align="left" bgcolor="#EEEEEE" class="white_bold"><strong>账户余额付款(您的账户余额为:<font color="red"><%=accountmoney %></font>元,您选择的商品总价为:<font color="red"><%=professionTotalPrice + shoppingTotalPrice %></font>)</strong>
               
               &nbsp;<a href="Money.aspx" target="_self">礼品卡充值</a>
               </td>
	        </tr>
            <tr align="left" style=" color:Red">
             * 礼品商城物品不够100元加10元送货费
            </tr>
             <tr style="display:none">
		       <td height="25" align="left">　　
                  输入账户金额：<input type="text" name="amountmoney" id="amountmoney" onchange="setPayMoney()"  value="0" />
               </td>
	        </tr>
             <tr>
		       <td height="25"></td>
	        </tr>
            </table>
             <%} %>
          <%} %>

            <%if (LoginMember == null && LoginMember.UserCardCodeList == null)
          { %>  <%if (true)
         { %>

      <!--   <% if(true){ %>
         <div id="divCardMessage" style="width:95%; text-align:left; line-height:30px;" runat="server" ><font color="red"> 如果您需要礼品卡付款，请先登录充值！</font> </div>
         <% } %> -->
                <table cellpadding="5" cellspacing="0"  width="95%">
		     <tr>
		       <td height="25" align="left" bgcolor="#EEEEEE" class="white_bold"><strong>选择结算方式(您还需支付<font color="red"> <span id="spanmoney" ><%=professionTotalPrice + shoppingTotalPrice%></span></font>元)</strong>
                <input id="cardpaymoney" name="cardpaymoney" value="0" type="hidden" />
               <input id="paymoney" name="paymoney" value="<%=professionTotalPrice + shoppingTotalPrice %>" type="hidden" />
               </td>
	        </tr>
		   </table>
              <table id="payway" cellpadding="5" cellspacing="0"  width="95%">
		     <tr>
		       <td height="25" align="left">
               <input type="hidden" name="pay"  value="pay"/>

               <br /> 
               <!--
               <input type="radio" name="pay" checked="checked"   value="directPay"/><img src="images/alipay_1.gif" border="0" />
               -->
               </td>
	        </tr>
		     
           
	      </table>
             <%} %>
          <%} %>
		</div>
		<br />
    
		
	   <%if (true){ %>
        <br />
        <div style="width:95%; text-align:left; display:none;" >
        订单号：<asp:Label ID="lblordercode"  runat="server" ForeColor="Red"><%=tempOrderCode%></asp:Label>
        <input name="ordercode" type="hidden" value="<%=tempOrderCode%>" /> 
        </div>
         <table width="95%" border="0" cellpadding="0" cellspacing="0">
          <tr>     
            <td height="30" align="center">
            <input type="hidden" name="action" value="add" />
            <input type="submit" name="Submit" value="提交" class="button" onclick="return CheckFrm();" /></td>
          </tr>
        </table>
        <br />
        <%} %>

          </form>
	  </div>
     

</div>   


   <uc3:bottom ID="bottom_1" runat="server" />
</center>


</body>
</html>
